<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

// 返回首页
const goHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.go(-1)
}
</script>

<template>
  <div class="error-page">
    <div class="error-container">
      <!-- 404图标 -->
      <div class="error-icon">
          <!-- 404数字 -->
          <text x="100" y="80" class="error-number">404</text>
      </div>

      <!-- 错误信息 -->
      <div class="error-content">
        <h1 class="error-title">Page Not Found</h1>
        <p class="error-description">
          Sorry, the page you are trying to access does not exist or has been removed.
        </p>
        <p class="error-suggestion">
          Please check if the URL is correct, or try the following:
        </p>
      </div>

      <!-- 操作按钮 -->
      <div class="error-actions">
        <button class="btn btn-primary" @click="goHome">
          <svg class="btn-icon" viewBox="0 0 24 24">
            <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
          </svg>
          Return Home
        </button>
        <button class="btn btn-secondary" @click="goBack">
          <svg class="btn-icon" viewBox="0 0 24 24">
            <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
          </svg>
          Go Back
        </button>
      </div>

      <!-- 额外信息 -->
      <div class="error-footer">
        <p class="footer-text">
          If the problem persists, please contact the administrator.
        </p>
      </div>
    </div>

    <!-- 背景装饰 -->
    <div class="background-decoration">
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
      <div class="floating-shape shape-4"></div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.error-container {
  background: white;
  border-radius: 20px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 100%;
  position: relative;
  z-index: 2;
  
  @media (max-width: 768px) {
    padding: 40px 30px;
    margin: 20px;
  }
}

.error-icon {
  margin-bottom: 30px;
}

.error-svg {
  width: 200px;
  height: 120px;
  
  @media (max-width: 768px) {
    width: 160px;
    height: 100px;
  }
}

.error-number {
  font-size: 108px;
  font-weight: bold;
  color: #e74c3c;
  text-anchor: middle;
  font-family: 'Arial', sans-serif;
  
  @media (max-width: 768px) {
    font-size: 40px;
  }
}

.error-content {
  margin-bottom: 40px;
}

.error-title {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 16px;
  font-weight: 600;
  
  @media (max-width: 768px) {
    font-size: 2rem;
  }
}

.error-description {
  font-size: 1.1rem;
  color: #7f8c8d;
  margin-bottom: 16px;
  line-height: 1.6;
}

.error-suggestion {
  font-size: 1rem;
  color: #95a5a6;
  margin-bottom: 0;
}

.error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 30px;
  
  @media (max-width: 768px) {
    flex-direction: column;
    align-items: center;
  }
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  
  @media (max-width: 768px) {
    width: 200px;
    justify-content: center;
  }
}

.btn-primary {
  background: #3498db;
  color: white;
  
  &:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
  }
}

.btn-secondary {
  background: #95a5a6;
  color: white;
  
  &:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(149, 165, 166, 0.3);
  }
}

.btn-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.error-footer {
  border-top: 1px solid #ecf0f1;
  padding-top: 20px;
}

.footer-text {
  font-size: 0.9rem;
  color: #bdc3c7;
  margin: 0;
}

// 背景装饰
.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 6s ease-in-out infinite;
}

.shape-1 {
  width: 80px;
  height: 80px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 60px;
  height: 60px;
  top: 20%;
  right: 15%;
  animation-delay: 2s;
}

.shape-3 {
  width: 100px;
  height: 100px;
  bottom: 15%;
  left: 15%;
  animation-delay: 4s;
}

.shape-4 {
  width: 40px;
  height: 40px;
  bottom: 25%;
  right: 20%;
  animation-delay: 1s;
}

// 动画
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes wave {
  0%, 100% {
    d: path("M60 140 Q100 160 140 140");
  }
  50% {
    d: path("M60 140 Q100 120 140 140");
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-20px) rotate(120deg);
  }
  66% {
    transform: translateY(10px) rotate(240deg);
  }
}
</style>